const express = require("express");

// 1. 创建路由对象
const userRouter = express.Router();

// 2. 定义路由对象中的映射接口
userRouter.get("/", (req, res) => {
  res.json("用户数据列表");
});

userRouter.get("/:id", (req, res) => {
  const id = req.params.id;
  res.json("用户数据详情" + id);
});

userRouter.post("/", (req, res, next) => {
  res.json("创建用户成功");
});

userRouter.delete("/:id", (req, res, next) => {
  const id = req.params.id;
  res.json("删除用户成功" + id);
});

userRouter.patch("/:id", (req, res, next) => {
  const id = req.params.id;
  res.json("更新用户成功" + id);
});

module.exports = userRouter;
